{extend name="layout:base" /}
{block name="page_content"}
  <div class="row maintop">
    <div class="col-xs-12">
      <form name="form_search" class="form-search form-inline" method="get" action="{:url('index')}">
        <?php if($auth->check('create')): ?>
          <div class="form-group">
            <a href="{:url('create')}" class="btn btn-sm btn-primary mr-10">
              <i class="ace-icon fa fa-plus bigger-110"></i>
              添加
            </a>
          </div>
        <?php endif; ?>
        <div class="form-group">
          <label>关键词：</label>
          <div class="input-group">
            <span class="input-group-addon">
              <i class="ace-icon fa fa-check"></i>
            </span>
            <input type="text" name="keyword" id="keyword" class="form-control" value="{$param.keyword|default=''}" placeholder="请输入关键词" />
            <span class="input-group-btn">
              <button type="submit" class="btn btn-purple btn-sm">
                <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                搜索
              </button>
            </span>
            </a>
          </div>
        </div>
        <div class="form-group">
          <a href="{:url('index')}" class="btn btn-sm  btn-purple ml-10">
            <span class="ace-icon fa fa-globe icon-on-right bigger-110"></span>
            显示全部
          </a>
        </div>
      </form>
    </div>
  </div>

  <div class="row">
    <div class="col-xs-12">
      <form method="post" action="{:url('resort')}" >
        <table class="table table-striped table-bordered table-hover" id="dynamic-table">
          <thead>
            <tr>
              <th>用户ID</th>
              <th>登录名</th>
              <th>真实姓名</th>
              <th class="field-avatar">用户头像</th>
              <th>用户角色</th>
              <th>启用状态</th>
              <th>上次登录时间</th>
              <th>上次登录IP</th>
              <th class="center">操作</th>
            </tr>
          </thead>
          <tbody>
            <?php $list = $res->all(); ?>
            {volist name="$list" id="vo"}
              <tr>
                <td>
                  <a href="{:url('read', ['id' => $vo['id']])}" target="_blank">
                    {$vo.id}
                  </a>
                </td>
                <td>
                  <a href="{:url('read', ['id' => $vo['id']])}" target="_blank">
                    {$vo.name}
                  </a>
                </td>
                <td>
                  {$vo.nickname}
                </td>
                <td class="field-avatar">
                  <img src="{$vo.avatar}" class="img-circle" alt="{$vo.name}">
                </td>
                <td>
                  {$vo.group_title}
                </td>
                <td>
                  {$vo.status|get_field_text='user_status',###}
                </td>
                <td>
                  {$vo.last_login_time|format_show_time=###}
                </td>
                <td>
                  {$vo.last_ip}
                </td>
                <td class="center">
                  <?php if($auth->check('update')): ?>
                    <a class="green" href="{:url('update', ['id' => $vo['id']])}">
                      <i class="ace-icon fa fa-pencil bigger-130"></i>编辑
                    </a>
                  <?php endif; ?>
                  <?php if($auth->check('delete')): ?>
                    <a class="red" href='javascript:void(0)' onclick="alert_del('{:url("delete", ['id' => $vo['id']])}', '确认要删除吗？');" class="tooltip-error" data-rel="tooltip" title="删除">
                      <i class="ace-icon fa fa-trash-o bigger-130"></i>删除
                    </a>
                  <?php endif; ?>
                </td>`
              </tr>
            {/volist}
          </tbody>
        </table>
      </form>
      <div>
        <?php echo($res->render()); ?>
      </div>
    </div>
  </div>
{/block}